home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / tex / dvivga9.zip / FIXPOS.H < prev    next >
Text File  |  1988-05-30  |  1KB  |  37 lines

  1. /* -*-C-*- fixpos.h */
  2. /*-->fixpos*/
  3. /**********************************************************************/
  4. /******************************* fixpos *******************************/
  5. /**********************************************************************/
  6. COORDINATE
  7. fixpos(cc,c,cnvfac)
  8. register COORDINATE cc;        /* coordinates in device pixels */
  9. register INT32 c;        /* coordinates in DVI units */
  10. register float cnvfac;        /* converts DVI units to pixels */
  11. {
  12.     register COORDINATE ccc;
  13.  
  14.     /*
  15.     A sequence  of consecutive  rules, or  consecutive characters  in  a
  16.     fixed-width font whose width is not an integer number of pixels, can
  17.     cause |cc| to  drift far away  from a correctly  rounded value.   We
  18.     follow DVITYPE Version 2.6 to ensure  that the amount of drift  will
  19.     never exceed MAXDRIFT pixels.  DVITYPE Version 2.0 did not do  this,
  20.     and the results could be visibly AWFUL!!
  21.     */
  22.  
  23.     ccc = PIXROUND(c,cnvfac);
  24.     if (ABS(ccc-cc) > MAXDRIFT)
  25.     {        /* drag cc toward the correctly rounded value ccc */
  26.         if (ccc > cc)
  27.     {
  28.         cc = ccc - MAXDRIFT;
  29.     }
  30.         else
  31.     {
  32.             cc = ccc + MAXDRIFT;
  33.     }
  34.     }
  35.     return (cc);
  36. }
  37.